GtkFilechooserWidget: prevent oblivious selection of file
authorNelson Benítez León <nbenitezl@gmail.com>
Tue, 14 Apr 2020 20:01:12 +0000 (16:01 -0400)
committerNelson Benítez León <nbenitezl@gmail.com>
Wed, 15 Apr 2020 20:46:43 +0000 (16:46 -0400)
commit45d7051dffcc51d9b6a08aa35f3838f2bdd3e2dd
tree9770956a05697fef7fbf427a01b2f220c5ce2893
parentc4e66ec485651a06e88df95c0ee75d93ed5a6d4c
GtkFilechooserWidget: prevent oblivious selection of file

which could happen after confirming the "file overwrite"
dialog and may result in a different file being overwritten
causing data loss.

The oblivious file selection can be done by a mouse
click or keyboard press sent inadvertently just after
confirming the "file overwrite" dialog (and before the
enclosing GtkfilechooserDialog is closed).

Fixed by adding a flag to ignore any button/key press
events sent to the file list. We set this flag just
after the user accepts the "file overwrite" dialog (which
means the enclosing GtkfilechooserDialog is about to
get closed). And we restablish the flag when the dialog
is shown again (in its map() handler).

Fixes data loss issue #2288
gtk/gtkfilechooserwidget.c